$(function () {

    //初始化表格
    initTable();
});


function initTable() {
    var options = {
        url: prefix + "/list",
        createUrl: prefix + "/addInit",
        updateUrl: prefix + "/editInit/{id}",
        removeUrl: prefix + "/remove",
        sortName: "createTime",
        sortOrder: "desc",
        modalName: "字典类型",
        search: false,
        showExport: false,
        columns: [{
            checkbox: true
        },{
            field: 'dictId',
            title: '字典类型编号'
        },{
            field: 'dictType',
            title: '字典类型',
            sortable: true
        },{
            field: 'dictName',
            title: '字典类型名称',
            sortable: true
        },{
            field: 'status',
            title: '状态',
            sortable: true,
            formatter: function (value, row, index) {
                return $.table.selectDictValue(statusDatas, value);
            }
        },{
            field: 'createTime',
            title: '创建时间',
            sortable: true
        },{
            title: '操作',
            align: 'center',
            formatter: function(value, row, index) {
                var actions = [];
                actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.editFull(\'' + row.dictId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                actions.push('<a class="btn btn-info btn-xs ' + listFlag + '" href="#" onclick="detail(\'' + row.dictId + '\')"><i class="fa fa-list-ul"></i>列表</a> ');
                actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.dictId + '\')"><i class="fa fa-remove"></i>删除</a>');
                return actions.join('');
            }
        }]
    }
    $.table.init(options);
}

/*字典列表-详细*/
function detail(dictId) {
    var url = prefix + '/detail/' + dictId;
    createMenuItem(url, "字典数据");
}
